package utils;

import core.DispatcherMapping;
import core.MappingConfig;
import org.jdom.Attribute;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;

import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * Created by zhangsen on 2016/10/25.
 */
public class XmlUtils {


    public static Document readXmlFile(String filePath)
    {
        SAXBuilder builder=new SAXBuilder();
        Document doc = null;
        try {
             doc=builder.build(getFile(filePath));
        } catch (JDOMException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return doc;
    }

    private static File getFile(String filePath)
    {
        return new File(XmlUtils.class.getResource("/").getPath()+filePath);
    }

}
